/**
 * @author chenjuan
 * @description 定义登陆接口
 */

import axios from 'axios'
import Ajax from './Ajax'
/**
 * @param {String} phone 电话号码
 * @returns Promise请求回调
 */

function getCodeApi(phone) {
    return Ajax({
        url: '/user/validate/code',
        data: {phone}
    })
    
}

/**
 * 登陆接口
 * @param {Object} data
 * @returns result
 */
export const loginApi = data => {
    return Ajax({
        url:'/user/app/login',
        data
    })
}

/**
 * 获取用户信息
 * @param {String} id 
 * @returns Promise
 */
export const userInfoApi = id => {
    return Ajax({
        url: '/user/info',
        method: 'GET',
        params: {id}
    })
}

export const autoLoginApi = () => Ajax({url: '/user/auto/login'})

export {getCodeApi}